extern crate net_brd;

use net_brd::ChainData;
use net_brd::ChainNet;
// use net_brd::Chain;
// use net_brd::CmdRun;
use net_brd::Client;

// use net_brd::Chain;
// use net_brd::ChainNet;

// use net_brd::net::AliveClient;

// struct test;
// impl ChainNet for test {
//     fn action(&self, chain: &Chain) -> bool{
//         return true;
//     }
// }

fn main() {
    let t = "cmd://curl->3 | wraper://to_css,a[href] | wraper://to_grep,douban ".to_task();
    println!("{}",t.unwrap());
    for uid in net_brd::ls_brd(){
        uid.chain_remove();
    }

    let mut b = "curl".with_cmd()
            .args(&vec!["https://www.douban.com"])
            .wraper("to_css", vec!["a[href]"])
            .wraper("to_grep", vec!["book"])
            .wraper("to_re", vec!["http.+douban.+"])
                .new_chain();
    // let sub_chain = "curl".with_cmd()
    //     .wraper("to_css", vec!["li"])
    //     .new_chain();
    b.loc.host = "localhost:54321".to_string();
    let client = Client::default();
    log::info!("{:?}", &b);
    client.action(&b);

    // Chain::wait();
    // log::info!("{:?}", b.task_path().file_open_str());

}